package com.wulis.generator.config;

import com.wulis.generator.model.Table;
import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author WuliBao
 */
@Getter
public class TableConfig {

    /**
     * 过滤前缀
     */
    private String[] prefix;

    /**
     * 表配置
     */
    private List<Table> tables;

    private TableConfig() {}

    public static TableConfig build() {
        TableConfig tableConfig = new TableConfig();
        tableConfig.prefix = new String[] {};
        tableConfig.tables = new ArrayList<>();
        return tableConfig;
    }

    public TableConfig prefix(String[] prefix) {
        this.prefix = prefix;
        return this;
    }

    public TableConfig table(Table table) {
        this.tables.add(table);
        return this;
    }

    public TableConfig table(String name) {
        this.tables.add(Table.build().name(name));
        return this;
    }
}
